ubuntu安装Google Chrome 浏览器和ChromeDriver 您所在的位置:网站首页 ubuntu安装 chrome ubuntu安装Google Chrome 浏览器和ChromeDriver

ubuntu安装Google Chrome 浏览器和ChromeDriver

2024-07-13 08:04| 来源: 网络整理| 查看: 265

要在Ubuntu上安装Google Chrome浏览器和ChromeDriver,可以按照以下步骤操作:

1. 安装Google Chrome 浏览器

下载Google Chrome 的最新版本。

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

使用dpkg安装下载的deb包。

sudo dpkg -i google-chrome-stable_current_amd64.deb

如果在安装过程中遇到了依赖问题,您可以使用下面的命令来自动修复它。

sudo apt-get install -f

此时,可以在Ubuntu中找到Google Chrome浏览器,并运行它。

2. 安装ChromeDriver

首先,需要查看您已经安装的Chrome浏览器的版本。

google-chrome --version

记下显示的版本号,然后去 ChromeDriver的官方下载页面 找到与您的Chrome浏览器版本匹配的ChromeDriver版本。

下载对应的ChromeDriver版本。例如,如果您的Chrome版本是90.0.4430.24,则应该下载该版本的ChromeDriver。

wget https://chromedriver.storage.googleapis.com//chromedriver_linux64.zip

其中 需要替换为您查到的版本号。

解压下载的文件。

unzip chromedriver_linux64.zip

移动解压后的 chromedriver 到/usr/bin/或其他在PATH环境变量中的目录,以便可以全局访问。

sudo mv chromedriver /usr/bin/

为chromedriver赋予可执行权限。

sudo chmod +x /usr/bin/chromedriver

现在,已经成功地在Ubuntu上安装了Google Chrome和ChromeDriver。可以使用命令google-chrome来启动浏览器,并使用命令chromedriver来启动ChromeDriver。



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有